#define _CRT_SECURE_NO_WANINGS 1
#pragma warning(disable: 4996)

class Solution {
    int tmp = 0;
public:
    int mul(int a, int b) {
        if (b == 1) return a;
        return mul(a + tmp, b - 1);
    }
    int multiply(int A, int B) {
        tmp = A;
        return mul(A, B);
    }
};